package com.framework.demo.controller;

import com.framework.demo.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class HelloController {

   /* @ModelAttribute
    public void populateMode(ModelMap model) {
        model.addAttribute("message", "my Hello world");
    }*/


    @RequestMapping(value = "/" ,method = RequestMethod.GET)
    public String printWelcome(ModelMap model) {
        model.addAttribute("message", "Hello world!");
        return "hello";
    }

    @RequestMapping(value = "/hello/getData", method = RequestMethod.POST)
    @ResponseBody
    public Map<String,Object> getData() {
        Map<String,Object> map = new HashMap<String, Object>();
        map.put("abc",123);
        map.put("ddd",new Date());
        return map;
    }


}